module LogiLang.Lexer where

import Text.Parsec
import qualified Text.Parsec.Token as Token

opChar = oneOf "?"

keywords = [
	"assert", "rule", "pass",
	"and", "or", "not"
	]

langdef =
    Token.LanguageDef
        "{-" "-}" "--" True  -- comments
        letter (alphaNum <|> oneOf "_")   -- identifiers (start, rest)
        opChar opChar   -- operators (first, rest)
        keywords -- keywords
        ["?"] -- reserved operators
        True -- case sensitive

lexer :: Token.TokenParser ()
lexer = Token.makeTokenParser langdef

whiteSpace = Token.whiteSpace lexer
identifier = Token.identifier lexer
parens = Token.parens lexer
reserved = Token.reserved lexer
reservedOp = Token.reservedOp lexer

